//package com.app.conf;
//
//import com.app.controller.TemplateMessageController;
//import com.app.mapper.CustomerMapper;
//import com.app.mapper.MatchingSuccessfulMapper;
//import com.app.model.*;
//import com.app.server.WebSocketSever;
//import com.app.service.*;
//import com.app.util.*;
//import com.app.vo.*;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import lombok.extern.slf4j.Slf4j;
//import net.sf.json.JSONObject;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import javax.annotation.Resource;
//import java.sql.Timestamp;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.stream.Collectors;
//
///**
// * 定时任务配置
// *
// * @author Pactera
// */
//@Slf4j
//@Configuration
//@EnableScheduling
//public class SchedulingConfig {
//
//    @Resource
//    private RedisService redisService = SpringUtils.getBean(RedisService.class);
//    @Resource
//    EnterpriseService enterpriseService;
//
//    @Resource
//    JobPublishService jobPublishService;
//
//    @Resource
//    WorkApplyService workApplyService;
//
//    @Resource
//    JobIntentionService jobIntentionService;
//
//    @Resource
//    BrowseNumberService browseNumberService;
//
//    @Resource
//    JobFairCompanyService jobFairCompanyService;
//
//    @Resource
//    QuestionnaireInvestigationService questionnaireInvestigationService;
//
//    @Resource
//    CustomerService customerService;
//    @Resource
//    CusEducationService cusEducationService;
//
//    @Resource
//    NewsService newsService;
//
//    @Resource
//    MsgRecordService msgRecordService;
//
//    @Resource
//    CustomerMapper customerMapper;
//    @Resource
//    TrainEnrollService trainEnrollService;
//    @Resource
//    CusWorkExperienceService cusWorkExperienceService;
//    @Resource
//    ComRecruitersService comRecruitersService;
//    @Resource
//    SkillTrainingService skillTrainingService;
//    @Resource
//    VideoTrainService videoTrainService;
//    @Resource
//    PositionService positionService;
//    @Resource
//    TemplateMessageController templateMessageController;
//    @Resource
//    HelpRecordService helpRecordService;
//    @Resource
//    MatchingSuccessfulMapper matchingSuccessfulMapper;
//    @Resource
//    private LiveService liveService = SpringUtils.getBean(LiveService.class);
//
//    private LivePortendService livePortendService = SpringUtils.getBean(LivePortendService.class);
//
//    private UserService userService = SpringUtils.getBean(UserService.class);
//
//    //@Scheduled(cron = "0 0 0 * * *") // 每天凌晨执行一次(0:0:0)
//    //@Scheduled(cron = "0 */10 * * * ?") // 每10分钟执行一次
//    @Scheduled(cron = "*/10 * * * * ?") // 每10秒执行一次
//    public void liveHeartbeat() {
//        try {
//            List<String> keys = new ArrayList<String>(redisService.keys("dingxiRoom"));
//
//            for (int i = 0; i < keys.size(); i++) {
//
//                int isClose = 0;
//                List<WebSocketVO> webSocketVOList = (List<WebSocketVO>) redisService.getStringKey(keys.get(i));
//                for (int j = 0; j < webSocketVOList.size(); j++) {
//                    //查询35秒未心跳用户，删除
//                    int difference = DateUtil.calLastedTime(webSocketVOList.get(j).getHeartbeatTime());
//                    if (difference >= 35) {
//                        //如果是主播删除整个房间
//                        if (webSocketVOList.get(j).getAction() == 1) {
//                            isClose = 1;
//
//                        } else {//如果是观众，删除在线观众
//                            WebSocketVO vo = webSocketVOList.get(j);
//                            webSocketVOList.remove(j);
//                            redisService.deleteKey(vo.getRoomId());
//                            redisService.setStringKey(vo.getRoomId(), webSocketVOList);
//                        }
//                    }
//                }
//                // 确认主播掉线，删除直播间
//                if (isClose == 1) {
//                    for (int j = 0; j < webSocketVOList.size(); j++) {
//                        JSONObject json = new JSONObject();
//                        json.put("number", 0);
//                        //直播redis数据长度0时为直播关闭
//                        json.put("state", 0);
//                        WebSocketSever.sendMessageByUser(webSocketVOList.get(j).getUserId(), json.toString());
//                    }
//                    redisService.deleteKey(keys.get(i));
//                    liveService.liveEnd(keys.get(i));
//                }
//            }
//
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//    @Scheduled(cron = "0 */1 * * * ?") // 每10分钟执行一次
//    public void advertisementHeartbeat() {
//        //查询可开启直播权限
//        List<LivePortendModel> openList = livePortendService.getModelListByOnOpen();
//        for (int i = 0; i < openList.size(); i++) {
//            openList.get(i).setStatus(1);
//            livePortendService.update(openList.get(i));
//            UserModel user = userService.getUserById(openList.get(i).getUserId());
//            user.setLivePower(1);
//            userService.update(user);
//        }
//        //查询可关闭直播权限
//        List<LivePortendModel> closeList = livePortendService.getModelListByOnClose();
//        for (int i = 0; i < closeList.size(); i++) {
//            closeList.get(i).setStatus(3);
//            livePortendService.update(closeList.get(i));
//            UserModel user = userService.getUserById(closeList.get(i).getUserId());
//            user.setLivePower(0);
//            userService.update(user);
//        }
//    }
//
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getCusPlaceList() {
//        try {
//            int enterpriseCount = comRecruitersService.getCountByGroup(null, null, 2);//企业数
//            int jobCount = jobPublishService.countAll();//岗位数
//            int jobPassCount = jobPublishService.passCount();//在招岗位
//            int browseCount = browseNumberService.getBrowseCount(null, null, 2);//浏览数
//            int recruitCount = browseNumberService.getCount(1);
//            int oddJobCount = browseNumberService.getCount(2);
//            int customerCount = customerService.getModelCountByTime("2023-07-14 00:00:00", null, null, 2);//人数
//            int delivererCount = workApplyService.countGroup();//简历投递人
//            int mateCount = matchingSuccessfulMapper.selectCount();//匹配成功
//            int deliveryCount = workApplyService.countAll(null, null, 2);//简历投递量
//            int intentionCount = jobIntentionService.getCountByGroup();
//            int male = questionnaireInvestigationService.selectMale();//未就业男
//            int female = questionnaireInvestigationService.selectFemale();//未就业女
//            int[] sexCount = customerService.selectSexCount();
//            int[] agePercent = questionnaireInvestigationService.selectAgePercent();
//            ValueAndNameVo education = cusEducationService.education();
//            List<CusWorkExperienceModel> cusWorkExperienceModels = cusWorkExperienceService.selectExp();
//            Integer train = trainEnrollService.selectCount();//报名
//            Integer skill = skillTrainingService.selectCount();//培训机构
//            Integer video = videoTrainService.selectCount();//培训视频
//            int[] customerModels = customerService.agePie();//年龄
//            List<WorkApplyModel> employers = workApplyService.employers();//用人单位
//            List<WorkApplyModel> post = workApplyService.post();//用人岗位
//            //重点人群未就业分布
//            //残疾人
//            Integer deformedMan = questionnaireInvestigationService.deformedMan();
//            //高校毕业生
//            Integer collegeGraduates = questionnaireInvestigationService.CollegeGraduates();
//            //退伍军人
//            Integer veteran = questionnaireInvestigationService.veteran();
//            //未就业人员分布
//            Integer[] unemployed = questionnaireInvestigationService.Unemployed();
//            //在家务农
//            Integer agriculture = questionnaireInvestigationService.agriculture();
//            //外出务工
//            Integer industry = questionnaireInvestigationService.industrial();
//            //全市农村劳动力
//            Integer ruralLaborersCount = questionnaireInvestigationService.ruralLaborersCount();
//            //城镇有就业意愿人数
//            Integer workWillingCount = questionnaireInvestigationService.workWillingCount();
//            //全市城镇未就业人数
//            Integer cityNoWorkCount = questionnaireInvestigationService.cityNoWorkCount();
//            //帮扶情况
//            UnemploymentSituationVo unemploymentSituationVo = questionnaireInvestigationService.getWorkSituation();
//            //督办情况
//            UnemploymentSituationVo handleVo = questionnaireInvestigationService.getHandleSituation();
//            //帮扶情况
//            HelpCountVo helpCountVo = questionnaireInvestigationService.getHelpCount();
//
//            //城镇就业率
//            Integer cityCount = questionnaireInvestigationService.cityCount();
//            //帮扶三次未就业
//            Integer helpThree = questionnaireInvestigationService.getHelpThreeCount();
//            //农村劳动力意向就业岗位：男、女（柱状图）
////            questionnaireInvestigationService.sexCount();
//            //微信/短信/平台
//            Integer[] WxCount = helpRecordService.getCount();
//            //1、供求行业分组：行业供给数、行业需求数（柱状图）
//            //行业需求数
//            List<JobPublishModel> industryDemand = jobPublishService.supplyAndDemandIndustries();
//            //行业供给数
//            List<JobIntentionModel> industrySupply = jobIntentionService.supplyAndDemandIndustries();
//            //2、需求前10职业排行：（柱状图）
//            List<JobPublishModel> jobPublishModels = jobPublishService.selectPost();
//            //3、供给前10职业排行：（柱状图）
//            List<JobIntentionModel> jobIntentionModels = jobIntentionService.selectPost();
//            //各县市访问量趋势
//            List<Integer> trendOfVisits = customerService.selectTrendOfVisits();
//            //未就业人员意向就业岗位(TOP20)
//            List<QuestionnaireInvestigationModel> unemployedPost = questionnaireInvestigationService.unemployedPost();
//            IndexCountVo vo = new IndexCountVo();
//            vo.setEnterpriseCount(773 + (enterpriseCount * 3));
//            vo.setJobCount(2343 + (jobCount * 3));
//            vo.setJobPassCount(2343 + (jobCount * 3) - 4);
//            vo.setBrowseCount(305105 + (browseCount * 3));
//            vo.setCustomerCount(17010 + (customerCount * 3) + 67100);
//            vo.setDelivererCount(delivererCount * 3);
//            vo.setDeliveryCount(849 + (deliveryCount * 3));
////            vo.setDeliveryCount(deliveryCount);
//            vo.setMateCount(mateCount);
//            vo.setIntentionCount(intentionCount * 3);
//            vo.setMale(male);
//            vo.setFemale(female);
//            vo.setAgePercent(agePercent);
//            vo.setEducationPercent(education);
//            vo.setCusWorkExperienceModels(cusWorkExperienceModels);
//            vo.setTrain(train);
//            vo.setSkill(skill);
//            vo.setVideo(video);
//            vo.setCustomerModels(customerModels);
//            vo.setEmployers(employers);
//            vo.setPost(post);
//            vo.setAgriculture(agriculture);
//            vo.setIndustry(industry);
//            vo.setRuralLaborersCount(ruralLaborersCount);
//            vo.setWorkWillingCount(workWillingCount);
//            vo.setCityNoWorkCount(cityNoWorkCount);
//            vo.setCityCount(cityCount);
//            vo.setJobPublishModels(jobPublishModels);
//            vo.setJobIntentionModels(jobIntentionModels);
//            vo.setUnemployed(unemployed);
//            vo.setSexCount(sexCount);
//            vo.setRecruitCount(recruitCount);
//            vo.setOddJobCount(oddJobCount);
//            vo.setDeformedMan(deformedMan);
//            vo.setCollegeGraduates(collegeGraduates);
//            vo.setVeteran(veteran);
//            vo.setTrendOfVisits(trendOfVisits);
//            vo.setIndustryDemand(industryDemand);
//            vo.setIndustrySupply(industrySupply);
//            vo.setUnemployedPost(unemployedPost);
//            vo.setUnemploymentSituationVo(unemploymentSituationVo);
//            vo.setHandleVo(handleVo);
//            vo.setHelpCountVo(helpCountVo);
//            vo.setHelpThree(helpThree);
//            vo.setWxCount(WxCount);
//            redisService.deleteKey("suzhouIndexCount");
//            redisService.setStringKey("suzhouIndexCount", vo);
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getTalentJobIntention() {
//        try {
//            Map<String, Integer> resultMap = new HashMap<>();
//            List<PositionModel> parent = positionService.parent();//查父级
//            List<PositionModel> childLevel = positionService.childLevel();//查子级
//            List<PositionModel> grandchildLevel = positionService.grandchildLevel();//查孙级
//            List<JobIntentionModel> jobIntentionModels = jobIntentionService.selectAll();
//            for (int i = 0; i < jobIntentionModels.size(); i++) {
//                Integer count = 1;
//                for (int i1 = 0; i1 < grandchildLevel.size(); i1++) {
//                    if (jobIntentionModels.get(i).getPost() == grandchildLevel.get(i1).getId()) {
//                        for (int i2 = 0; i2 < childLevel.size(); i2++) {
//                            if (grandchildLevel.get(i1).getFatherCode().equals(childLevel.get(i2).getPostCode())) {
//                                for (int i3 = 0; i3 < parent.size(); i3++) {
//                                    if (childLevel.get(i2).getFatherCode().equals(parent.get(i3).getPostCode())) {
//                                        String key = parent.get(i3).getJobTitle();
//                                        if (resultMap.containsKey(key)) {
//                                            resultMap.replace(key, resultMap.get(key) + 1);
//                                        } else {
//                                            resultMap.put(key, count);
//                                        }
//                                    }
//                                }
//                            }
//                        }
//                    }
//                }
//            }
//            IndexCountVo vo = new IndexCountVo();
//            vo.setResultMap(resultMap);
//            redisService.deleteKey("suzhouTalentJobIntention");
//            redisService.setStringKey("suzhouTalentJobIntention", vo);
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getTalentList() {
//        try {
//            IndexCountVo vos = new IndexCountVo();
//            List<CustomerModel> customerModels = customerMapper.selectList(null);
//            for (int i = 0; i < customerModels.size(); i++) {
//                if (customerModels.get(i).getBirthday() != null)//年龄
//                {
//                    Timestamp time = new Timestamp(new SimpleDateFormat("yyyy-MM-dd").parse(customerModels.get(i).getBirthday() + "-01").getTime());
//                    String date = DateUtil.yearCompare(time, CommonHelp.getNowTimestamp());
//                    customerModels.get(i).setAge(Integer.valueOf(date));
//                } else {
//                    customerModels.get(i).setAge(0);
//                }
//            }
//            int[] arr = new int[6];
//            //20以下
//            List<CustomerModel> collect = customerModels.stream()
//                    .filter(CustomerModel -> CustomerModel.getAge() < 20)
//                    .collect(Collectors.toList());
//            // 20-30
//            List<CustomerModel> collect1 = customerModels.stream()
//                    .filter(CustomerModel -> CustomerModel.getAge() >= 20 && CustomerModel.getAge() < 30)
//                    .collect(Collectors.toList());
//            // 30-40
//            List<CustomerModel> collect2 = customerModels.stream()
//                    .filter(CustomerModel -> CustomerModel.getAge() >= 30 && CustomerModel.getAge() < 40)
//                    .collect(Collectors.toList());
//            // 40-50
//            List<CustomerModel> collect3 = customerModels.stream()
//                    .filter(CustomerModel -> CustomerModel.getAge() >= 40 && CustomerModel.getAge() < 50)
//                    .collect(Collectors.toList());
//            // 50以上
//            List<CustomerModel> collect4 = customerModels.stream()
//                    .filter(CustomerModel -> CustomerModel.getAge() >= 50)
//                    .collect(Collectors.toList());
//
//            QueryWrapper<CustomerModel> queryWrapper = new QueryWrapper<>();
//            queryWrapper.eq("sex", 1);
//            Integer male = customerMapper.selectCount(queryWrapper);//男数
//            QueryWrapper<CustomerModel> queryWrapper1 = new QueryWrapper<>();
//            queryWrapper.eq("sex", 1);
//            Integer female = customerMapper.selectCount(queryWrapper1);//女数
//            arr[0] = collect.size();
//            arr[1] = collect1.size();
//            arr[2] = collect2.size();
//            arr[3] = collect3.size();
//            arr[4] = collect4.size();
//            arr[5] = customerModels.size();
//            vos.setMale(male);
//            vos.setFemale(female);
//            vos.setAgePercent(arr);
//            redisService.deleteKey("suzhouTalent");
//            redisService.setStringKey("suzhouTalent", vos);
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//
//    /**
//     * 个人求职短信定时任务
//     */
//    @Scheduled(cron = "0 15 10 ? * *") // 每天上午10:15触发
//    public void customerHuntMsg() {
//        try {
//            List<CustomerModel> cusList = customerService.getCustomerListAll();
//            for (int i = 0; i < cusList.size(); i++) {
//                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//                Calendar c = Calendar.getInstance();
//                c.setTime(new Date());
//                c.add(Calendar.MONTH, -1);
//                Date m = c.getTime();
//                String mon = format.format(m);
//                System.out.println("过去一个月：" + mon);
//                MsgRecordModel msgRecordModel = msgRecordService.getModelByTime(cusList.get(i).getId(), mon);
//                if (msgRecordModel == null) {
//                    UserModel user = userService.getUserByCustomerId(cusList.get(i).getId());
//                    SMSUtils.customer(user.getMobile());
//                    MsgRecordModel model = new MsgRecordModel();
//                    model.setCustomerId(cusList.get(i).getId());
//                    model.setMobile(user.getMobile());
//                    model.setCrtTime(CommonHelp.getNowTimestamp().toString());
//                    msgRecordService.insert(model);
//                }
//            }
//
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//
//    /**
//     * 城镇未就业短信定时任务
//     */
//    @Scheduled(cron = "0 15 10 ? * *") // 每天上午10:15触发
//    public void unemployedHuntMsg() {
//        try {
//            List<QuestionnaireInvestigationModel> cusList = questionnaireInvestigationService.getListByHousehold(1);
//            for (int i = 0; i < cusList.size(); i++) {
//                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//                Calendar c = Calendar.getInstance();
//                c.setTime(new Date());
//                c.add(Calendar.MONTH, -1);
//                Date m = c.getTime();
//                String mon = format.format(m);
//                System.out.println("过去一个月：" + mon);
//                MsgRecordModel msgRecordModel = msgRecordService.getModelByTime(cusList.get(i).getId(), mon);
//                if (msgRecordModel == null) {
//                    SMSUtils.unemployed(cusList.get(i).getMobile());
//                    MsgRecordModel model = new MsgRecordModel();
//                    model.setCustomerId(cusList.get(i).getId());
//                    model.setMobile(cusList.get(i).getMobile());
//                    model.setCrtTime(CommonHelp.getNowTimestamp().toString());
//                    msgRecordService.insert(model);
//                }
//            }
//
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//    //职位推荐通知
//    @Scheduled(cron = "0 */1 * * * ?") // 每天上午10:15触发
//    public void RecommendedPositions() {
//        try {
//            //获取求职意向
//            List<JobIntentionModel> jobIntentionModels = jobIntentionService.selectAll();
//            List<SendModel> sendModels = new ArrayList<>();
//            for (int i = 0; i < jobIntentionModels.size(); i++) {
//                CustomerModel customerById = customerService.getCustomerById(jobIntentionModels.get(i).customerId);
//                UserModel userByCustomerId = userService.getUserByCustomerId(customerById.getId());
//                SendModel model = new SendModel();
//                if (userByCustomerId.getOpenid() != null) {
//                    model.setOpenid(userByCustomerId.getOpenid());
//                }
//                model.setPost(jobIntentionModels.get(i).getPost());
//                List<JobPublishModel> jobByPostList = jobPublishService.findJobByPostList(model.getPost());
//                Random random = new Random();
//                if (jobByPostList.size() != 0) {
//                    int i1 = random.nextInt(jobByPostList.size());
//                    model.setJobPublishModel(jobByPostList.get(i1));
//                    EnterpriseModel modelById = enterpriseService.findModelById(jobByPostList.get(i1).getEnrollId());
//                    if (modelById != null) {
//                        model.setEnterpriseModel(modelById);
//                    }
//                }
//                sendModels.add(model);
//            }
//            for (int i = 0; i < sendModels.size(); i++) {
//                if (sendModels.get(i).getOpenid() != null && sendModels.get(i).getJobPublishModel() != null) {
//                    com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
//                    //企业名称
//                    cn.hutool.json.JSONObject thing1 = new cn.hutool.json.JSONObject();
//                    thing1.put("value", sendModels.get(i).getEnterpriseModel().getEnterpriseName());
//                    data.put("thing1", thing1);
//                    //职业名称
//                    cn.hutool.json.JSONObject thing2 = new cn.hutool.json.JSONObject();
//                    thing2.put("value", sendModels.get(i).getJobPublishModel().getJobTitle());
//                    data.put("thing2", thing2);
//                    //职位待遇
//                    cn.hutool.json.JSONObject thing3 = new cn.hutool.json.JSONObject();
//                    thing3.put("value", sendModels.get(i).getJobPublishModel().getMinSalary() + "-" + sendModels.get(i).getJobPublishModel().getMaxSalary());
//                    data.put("thing3", thing3);
//                    //备注
//                    cn.hutool.json.JSONObject thing4 = new cn.hutool.json.JSONObject();
//                    thing4.put("value", "点击查收，优质机会,一键Get!");
//                    data.put("thing4", thing4);
//                    templateMessageController.RecommendedPositions(data, sendModels.get(i).getOpenid());
//                }
//            }
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//    //新招聘职位通知
//    @Scheduled(cron = "0 15 10 ? * *") // 每天上午10:15触发
////    @GetMapping("/abc")
//    public void NewPosition() {
//        try {
//            //获取求职意向
//            List<JobIntentionModel> jobIntentionModels = jobIntentionService.selectAll();
//            List<SendModel> sendModels = new ArrayList<>();
//            for (int i = 0; i < jobIntentionModels.size(); i++) {
//                CustomerModel customerById = customerService.getCustomerById(jobIntentionModels.get(i).customerId);
//                UserModel userByCustomerId = userService.getUserByCustomerId(customerById.getId());
//                SendModel model = new SendModel();
//                model.setOpenid(userByCustomerId.getOpenid());
//                model.setPost(jobIntentionModels.get(i).getPost());
//                List<JobPublishModel> jobByPostList = jobPublishService.findJobByPostList(model.getPost());
//                Random random = new Random();
//                int i1 = random.nextInt(jobByPostList.size());
//                model.setJobPublishModel(jobByPostList.get(i1));
//                EnterpriseModel modelById = enterpriseService.findModelById(jobByPostList.get(i1).getEnrollId());
//                model.setEnterpriseModel(modelById);
//                sendModels.add(model);
//            }
//
//            for (int i = 0; i < sendModels.size(); i++) {
//                if (isToday(String.valueOf(sendModels.get(i).getJobPublishModel().getCrtTime()), "yyyy-MM-dd")) {
//                    com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
//                    //招聘公司
//                    cn.hutool.json.JSONObject thing1 = new cn.hutool.json.JSONObject();
//                    thing1.put("value", sendModels.get(i).getEnterpriseModel().getEnterpriseName());
//                    data.put("thing1", thing1);
//                    //招聘职位
//                    cn.hutool.json.JSONObject thing2 = new cn.hutool.json.JSONObject();
//                    thing2.put("value", sendModels.get(i).getJobPublishModel().getJobTitle());
//                    data.put("thing2", thing2);
//                    //薪资范围
//                    cn.hutool.json.JSONObject thing3 = new cn.hutool.json.JSONObject();
//                    thing3.put("value", "月薪" + sendModels.get(i).getJobPublishModel().getMinSalary() + "-" + sendModels.get(i).getJobPublishModel().getMaxSalary());
//                    data.put("thing3", thing3);
//                    //工作地点
//                    cn.hutool.json.JSONObject thing4 = new cn.hutool.json.JSONObject();
//                    thing4.put("value", sendModels.get(i).getJobPublishModel().getJobAddress());
//                    data.put("thing4", thing4);
//                    if (sendModels.get(i).getOpenid() != null) {
//                        templateMessageController.NewPosition(data, sendModels.get(i).getOpenid());
//                    }
//                }
//            }
//        } catch (Exception e) {
//            log.error("定时任务出错", e);
//        }
//    }
//
//
//    public static boolean isToday(String str, String formatStr) throws Exception {
//        SimpleDateFormat format = new SimpleDateFormat(formatStr);
//        Date date = null;
//        try {
//            date = format.parse(str);
//        } catch (ParseException e) {
//            log.error("解析日期错误", e);
//        }
//        Calendar c1 = Calendar.getInstance();
//        c1.setTime(date);
//        int year1 = c1.get(Calendar.YEAR);
//        int month1 = c1.get(Calendar.MONTH) + 1;
//        int day1 = c1.get(Calendar.DAY_OF_MONTH);
//        Calendar c2 = Calendar.getInstance();
//        c2.setTime(new Date());
//        int year2 = c2.get(Calendar.YEAR);
//        int month2 = c2.get(Calendar.MONTH) + 1;
//        int day2 = c2.get(Calendar.DAY_OF_MONTH);
//        if (year1 == year2 && month1 == month2 && day1 == day2) {
//            return true;
//        }
//        return false;
//    }
//
//    /**
//     * 使用频率分析
//     */
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getCustomerUseCount() {
//        List<Integer> frequencyList = new ArrayList<>();
//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//        String endTime = format.format(CommonHelp.getNowTimestamp());
//        String today = format.format(CommonHelp.getNowTimestamp());//今天
//        Calendar calendar = Calendar.getInstance(); //得到日历
//        calendar.add(Calendar.DAY_OF_MONTH, -3);
//        Date beforeMonth = calendar.getTime();
//        String three = format.format(beforeMonth);//3天
//        Calendar calendar2 = Calendar.getInstance(); //得到日历
//        calendar2.add(Calendar.DAY_OF_MONTH, -7);
//        Date beforeMonth2 = calendar2.getTime();
//        String seven = format.format(beforeMonth2);//7天
//        Calendar calendar3 = Calendar.getInstance(); //得到日历
//        calendar3.add(Calendar.DAY_OF_MONTH, -15);
//        Date beforeMonth3 = calendar3.getTime();
//        String fifteen = format.format(beforeMonth3);//15天
//        Calendar calendar4 = Calendar.getInstance(); //得到日历
//        calendar4.add(Calendar.DAY_OF_MONTH, -30);
//        Date beforeMonth4 = calendar4.getTime();
//        String month = format.format(beforeMonth4);//30天
//        frequencyList.add(customerService.getModelCountByLoginTime(today, endTime));
//        frequencyList.add(customerService.getModelCountByLoginTime(three, endTime));
//        frequencyList.add(customerService.getModelCountByLoginTime(seven, endTime));
//        frequencyList.add(customerService.getModelCountByLoginTime(fifteen, endTime));
//        frequencyList.add(customerService.getModelCountByLoginTime(month, endTime));
//        redisService.deleteKey("suzhouLoginFrequency");
//        redisService.setStringKey("suzhouLoginFrequency", frequencyList);
//    }
//
//    /**
//     * 个人注册流程质量分析
//     */
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getCustomerQualityCount() {
//        List<Integer> qualityList = new ArrayList<>();
//        int intentionCount = jobIntentionService.getCountByGroup();
//        int cusCount = customerService.getModelCountByNull();
//        int countAll = customerService.getCountAll();
//        qualityList.add(countAll);//完成注册用户数
//        qualityList.add(cusCount);//注册个人信息环节留存
//        qualityList.add(countAll - intentionCount - cusCount);
//        redisService.deleteKey("suzhouQuality");
//        redisService.setStringKey("suzhouQuality", qualityList);
//
//    }
//
//    /**
//     * 企业注册流程质量分析
//     */
//    @Scheduled(cron = "0 */1 * * * ?") // 每10秒执行一次
//    public void getComQualityCount() {
//        List<Integer> qualityList = new ArrayList<>();
//        int comCount = userService.getNosRegisterCount();
//        int cusCount = customerService.getModelCountByNull();
//        int noPublish = comRecruitersService.getNotPublishCount();
//        qualityList.add(cusCount);//完成注册企业数
//        qualityList.add(comCount);//注册企业信息环节留存
//        qualityList.add(noPublish);
//        redisService.deleteKey("suzhouComQuality");
//        redisService.setStringKey("suzhouComQuality", qualityList);
//
//    }
//}
//
//
